<%--
  Created by IntelliJ IDEA.
  User: 隼
  Date: 2017/1/15
  Time: 11:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<html>
<head>
    <title>list</title>
    <script type="text/javascript" src="${pageContext.request.contextPath }/static/js/jquery-1.4.4.min.js">
    </script>
    <script type="text/javascript">
        function  deleteuser() {
         //   alert("");
            var drop=document.getElementsByName("user_id");
            var sql='';
            var  j=0;
            for(var i=0;i<drop.length;i++){
                if(drop[i].checked){
                    if(j==0){
                        sql+=drop[i].value;
                        j++;
                    }else{
                        sql+=","+drop[i].value;
                    }
                }
            }
                alert(sql);
            $.ajax({
                ajax:"false",
                type: "POST",            //http请求方式
                url: "${pageContext.request.contextPath }/sun/drop",    //服务器段url地址
                data: "sql=" + sql,           //发送给服务器段的数据
                dataType: "xml",  //告诉JQuery返回的数据格式
                success: callback  //定义交互完成，并且服务器正确返回数据时调用的回调函数
            });
        }
        function callback(data){
            var pass=$(data).find("pass").text();
            alert(pass);
            window.location = "${pageContext.request.contextPath }/sun/userlist";
        }
        </script>
</head>
<body>
<table width="100%" border=1>
    <tr>
        <td><input type="button" value="查询" onclick="queryItems()"/>
            <input type="button" value="批量删除" onclick="deleteuser()"/>
        </td>
    </tr>

</table>

成员列表
<table width="100%" border=1>

    <tr>
        <td>选择</td>
        <td>姓名</td>
        <td>性别</td>
        <td>生日</td>
        <td>班级</td>
        <td>爱好</td>
        <td>修改</td>
    </tr>

    <tr>
<c:forEach items="${userlist }" var="user">
    <tr>
        <td><input type="checkbox" name="user_id" value="${user.id}"/></td>
    <td>${user.name }</td>
    <td>${user.sex}</td>
    <td><fmt:formatDate value="${user.birthday}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
    <td>${user.cclass}</td>
    <td>${user.aihao}</td>
    <td><a href="${pageContext.request.contextPath }/sun/alterS?id=${user.id}">查看</a></td>
    </tr>
    </c:forEach>
</table>

</body>
</html>
